<!doctype html>
<html lang="{{ page.language | default: "en" }}" dir="{{ page.language_dir | default: "ltr" }}">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="/css/main.css">
    {% if page.custom_css %}
      <link rel="stylesheet" href="/css/{{ page.language }}.css">
    {% endif %}
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
    {% seo %}
  </head>
  <body>
    <ul class="nav lang" dir="ltr">
      {% assign sorted_languages = site.languages | sort %}
      {% for language in sorted_languages %}
        <li class="language language-{{ language[0] }}">
          <a rel="alternate" lang="{{ language[0] }}" hreflang="{{ language[0] }}"
            {% if language[0] == "en" %}
              href="/"
            {% else %}
              href="{{ language[0] | prepend: "/lang/" | append: "/" }}"
            {% endif %}
            >{{ language[1] | smartify }} ({{ language[0] }})</a>
        </li>
      {% endfor %}
    </ul>
    <ul class="nav">
      {% assign language = page.language | default: "en" %}
      {% for version in site.versions %}
        {% if language == "en" %}
          {% assign expected = "spec/v" | append: version | append: ".md" %}
        {% else %}
          {% assign expected = "lang/" | append: language | append: "/spec/v" | append: version | append: ".md" %}
        {% endif %}
        {% assign found = site.pages | where: "path", expected | first %}
        {% if found %}
          <li class="version version-{{ version }}">
            <a href="{{ found.url }}">{{ version }}</a>
          </li>
        {% endif %}
      {% endfor %}
    </ul>
    <div id="spec">
      {{ content }}
    </div>
    <script src="/js/anchorli.js"></script>
  </body>
</html>
